function Img2 = dctcomp(Img)
%DCTCOMP   zobrazi obrazek, ktery vznikne vynechanim vyssich frekvenci

%jake koeficienty se maji zachovat
Q = [ 1,1,1,1,1,0,0,0
      1,1,1,1,0,0,0,0
      1,1,1,0,0,0,0,0
      1,1,0,0,0,0,0,0
      1,0,0,0,0,0,0,0
      0,0,0,0,0,0,0,0
      0,0,0,0,0,0,0,0
      0,0,0,0,0,0,0,0 ];  
  
Img2 = zeros(size(Img));
for x = 1:8:(size(Img,2) - 7)
    for y = 1:8:(size(Img,1) - 7)
        B = dct2(Img(y:(y+7), x:(x+7)));
        B = B .* Q;
        Img2(y:(y+7), x:(x+7)) = idct2(B);
    end
end
imshow(Img2, [0 255]);
end

